import http from '@/axios';

//统一接口信息
//所有的请求全部统一在这里配置
//get请求示例,带参数
export const getUserInfo = (param) => http.get('url',param.id);
//get请求示例，不带参数
export const getUserList = () => http.get('url');
//post请求示例 带参数
export const validateLoginApi = (data) => http.post('url',data);
//post请求示例 不带参数
export const userlogout = () => http.post('url');
//建议使用的方法
//将post对象封装在一个form对象里，直接将对象作为参数传入
export const doMothed = (form) => http.post('url',form);

/**
 * 管理员功能部分
 */
//管理员登录
export const adminLogin = (form) => http.post('/admin/validateAdmin', form);
//获取当前图书馆基础数据
export const getCurrentLibData = () => http.get('/admin/getCurrentLibData');

//学院信息管理 按学院分组
export const getCollegeWithMajors = () => http.get('/colleges/getCollegeWithMajors');
//获取所有学院信息
export const getAllCollegeAndMajors = () => http.get('/colleges/getAllCollegeAndMajors');

/**
 * 学生功能部分
 */
//获取学生分页数据
export const getStudentPagerData = (data) => http.post('/user/getAllUserPagerData', data);
//学生证件照片上传接口
export const uploadPhoto = (data) => http.postFile('/file/uploadPhoto', data);
//添加新学生信息
export const addNewStudent = (data) => http.post('/user/addNewStudentInfo', data);
//通过学生图书证号获取学生及借阅信息
export const getUserBorrowInfoByCardno = (data) => http.post('/user/getUserBorrowInfoByCardno', data);
//学生管理中查询借阅历史记录
export const getUserBorrowHistoryData = (data) => http.post('/user/getUserBorrowHistoryData', data);

/**
 * 图书管理部分
 *  */
//获取图书分类数据
export const getAllBookCategory = () => http.get('/book/getAllBookCategory');
//添加图书分类
export const saveBookCategory = (data) => http.post('/book/addBookCategory', data);
//编辑修改图书分类
export const editBookCategory = (data) => http.post('/book/editBookCategory', data);
//图书封面上传
export const uploadBookCover = (data) => http.postFile('/file/uploadBookCover', data);
//添加图书信息
export const addNewBook = (data) => http.post('/book/addBook', data);
//编辑图书信息
export const editBook = (data) => http.post('/book/editBook', data);
//图书分页数据+查询
export const getBookPagerDataBySearch = (data) => http.post('/book/getBookPagerDataBySearch', data);
//通过ISBN获取图书信息
export const getBookInfoByISBN = (data) => http.post('/book/getBookInfoByISBN', data);

/**
 * 借阅管理部分
 */
//借阅图书
export const borrowBook = (data) => http.post('/book/borrowBook', data);
//归还图书 
export const returnBook = (data) => http.post('/book/returnBook', data);
//查询借阅订单分页数据
export const getBorrowOrderPagerData = (data) => http.post('/book/getBorrowOrderPagerData', data);

/**
 * 数据可视化
 */
//获取图书分类及书籍数量
export const getCategoryPieData = () => http.get('/echart/getCategoryPieData');
//获取本周借阅数据
export const getWeekBorrowData = () => http.get('/echart/getWeekBorrowData');

// 获取月度借阅数据
export const getMonthBorrowData = () => http.get('/echart/getMonthBorrowData');

// 获取年度借阅数据
export const getYearBorrowData = () => http.get('/echart/getYearBorrowData');
// 获取借阅排行榜数据
export const getTop5BorrowedBooks = () => http.get('/echart/getTop5BorrowedBooks');

/**
 * AI助手
 * 知识库功能
 */
// 根据语义分析获取图书信息列表
export const getBookInfoByAIAnalysis = (data) => http.post('/ai/getBookInfoByAIAnalysis', data);